#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2020 crane <crane@crane-pc>
#
# Distributed under terms of the MIT license.

"""

"""

class Solution(object):
    def numOfSubarrays(self, arr):
        single_num = 0
        even_num = 0

        for n in arr:
            if n % 2 == 0:
                even_num += 1
            else:
                single_num += 1

        print(single_num, even_num)

        sum = 0
        for s in range(1, single_num+1, 2):
            for e in range(0, even_num+1):
                p = self.c(single_num, s) * self.c(even_num, e)
                print(s, e, p)
                sum += p

        return sum

    def c(self, a, b):
        u = b
        if a - b < u:
            u = a - b

        return self.inner_c(a, u)

    def inner_c(self, a, u):
        p = 1

        for i in range(a-u+1, a+1):
            p *= i

        d = 1
        for i in range(1, u+1):
            d *= i

        # print(d, u)

        return p // d



def test():
    s = Solution()
    # r = s.c(5, 5)
    # r = s.inner_c(5, 2)
    # print(r)

    # r = s.numOfSubarrays([1, 3, 5])
    # r = s.numOfSubarrays([100, 100, 99, 99])
    r = s.numOfSubarrays([1, 2, 3, 4, 5, 6, 7])
    print(r)

def main():
    print("start main")
    test()

if __name__ == "__main__":
    main()
